package finalproject.controller.commands;

import finalproject.model.player.Player;
import finalproject.view.StringManager;

/**
 * the back command
 * @author Buisson Kevin
 *
 */
public class BackCommand extends Command {

	/**
	 * 
	 * @param player The player issuing the command
	 * @param args the command args
	 */
	public BackCommand(Player player, String[] args)
	{
		super(player, args);
	}

	@Override
	public boolean process()
	{
		// Go back
		if (getPlayer().goBack())
		{
			StringManager.outPutText(getPlayer().getCurrentRoom().toString() + "\n"
					+ getPlayer().getCurrentRoom().getExitString());
			return true;
		}
		
		// Back failed
		StringManager.outPut("cantback");
		return false;
	}

}
